package com.zxhhyj.ffmpeg.tag

import android.os.ParcelFileDescriptor
import java.io.File

public object MediaTag {

    public external fun getMediaFormatStreamInfo(fd: Int): FormatStreamInfo?

    public fun getMediaFormatStreamInfo(fd: ParcelFileDescriptor): FormatStreamInfo? {
        return getMediaFormatStreamInfo(fd.dup().detachFd())
    }

    public fun getMediaFormatStreamInfo(mediaFile: File): FormatStreamInfo? {
        val fd: ParcelFileDescriptor =
            ParcelFileDescriptor.open(mediaFile, ParcelFileDescriptor.MODE_READ_ONLY)
        return getMediaFormatStreamInfo(fd.dup().detachFd())
    }

    init {
        System.loadLibrary("avcodec")
        System.loadLibrary("avdevice")
        System.loadLibrary("avfilter")
        System.loadLibrary("avformat")
        System.loadLibrary("avutil")
        System.loadLibrary("swresample")
        System.loadLibrary("ffmpeg")
    }

}